package JJX;

import java.util.Scanner;

public class BuyTicket {
    public static void main(String[] args) {
        int price = 5000;
        Scanner input = new Scanner(System.in);
        while (true) {
        System.out.println("请问要买几月份的票？");
        int month = input.nextInt();
        System.out.println("头等舱，商务舱，经济舱买哪种？");
        String kind = input.next();
            if (month >= 4 && month <= 10) {
                if (kind.equals("头等舱")) {
                    System.out.println("你的票价为：" + price * 0.9);
                } else if (kind.equals("商务舱")) {
                    System.out.println("你的票价为：" + price * 0.8);
                } else if (kind.equals("经济舱")) {
                    System.out.println("你的票价为：" + price * 0.7);
                }
            } else {
                if (kind.equals("头等舱")) {
                    System.out.println("你的票价为：" + price * 0.5);
                } else if (kind.equals("商务舱")) {
                    System.out.println("你的票价为：" + price * 0.4);
                } else if (kind.equals("经济舱")) {
                    System.out.println("你的票价为：" + price * 0.3);
                }
            }
            System.out.println("是否继续购买？（y/n）");
            if (input.next().equals("n")){
                System.out.println("谢谢使用！");
                break;
            }

        }
    }
}
